/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.testis.gui.mvc.model.testbed;

import org.testis.gui.mvc.model.AbstractModel;
import org.testis.gui.mvc.controller.testbed.DeviceDefinitionController;

/**
 *
 * @author selcuk
 */
public class DeviceDefinitionModel extends AbstractModel {

    private Integer m_deviceId = 0;
    private String m_name = "";
    private Integer m_abstractGroupId = 0;
    private String m_lastError = "";
    private Boolean m_visibility = false;

    public void setVisibility(Boolean val) {
        if (val == null) {
            return;
        }
        Boolean oldVal = m_visibility;
        m_visibility = val;
        firePropertyChange(DeviceDefinitionController.VISIBLE_PROPERTY,
                oldVal,
                val);
    }

    public Boolean getVisibility() {
        return m_visibility;
    }

    public String getName() {
        return m_name;
    }

    public void setName(String name) {
        if (name == null) {
            name = "";
        }
        String oldName = m_name;
        m_name = name;
        firePropertyChange(DeviceDefinitionController.NAME_PROPERTY,
                oldName,
                name);
    }

    public String getLastError() {
        return m_lastError;
    }

    public void setLastError(String val) {
        if (val == null) {
            val = "";
        }
        String oldValue = m_lastError;
        m_lastError = val;
        firePropertyChange(DeviceDefinitionController.ERROR_PROPERTY, null,
                m_lastError);
    }

    /**
     * @return the m_abstractGroupId
     */
    public Integer getAbstractGroupId() {
        return m_abstractGroupId;
    }

    /**
     * @param m_abstractGroupId the m_abstractGroupId to set
     */
    public void setAbstractGroupId(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_abstractGroupId;
        m_abstractGroupId = val;
        firePropertyChange(DeviceDefinitionController.ABSTRACT_GROUP_PROPERTY,
                oldVal,
                val);
    }

    /**
     * @return the m_deviceId
     */
    public Integer getDeviceId() {
        return m_deviceId;
    }

    /**
     * @param val the m_deviceId to set
     */
    public void setDeviceId(Integer val) {
        if (val == null) {
            return;
        }
        Integer oldVal = m_deviceId;
        this.m_deviceId = val;
        firePropertyChange(DeviceDefinitionController.DEVICE_ID_PROPERTY,
                oldVal,
                val);
    }
}

